package com.waijiaojun.tpo.service;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

import com.waijiaojun.tpo.entity.OperationGuidePageMark;
import com.waijiaojun.tpo.repository.OperationGuidePageMarkDao;

@Service
public class OperationGuidePageMarkService {

    @Resource
    private OperationGuidePageMarkDao operationGuidePageMarkDao;

    public int insert(OperationGuidePageMark pojo) {
        return operationGuidePageMarkDao.insert(pojo);
    }

    public int insertSelective(OperationGuidePageMark pojo) {
        return operationGuidePageMarkDao.insertSelective(pojo);
    }

    public int insertList(List<OperationGuidePageMark> pojos) {
        return operationGuidePageMarkDao.insertList(pojos);
    }

    public int update(OperationGuidePageMark pojo) {
        return operationGuidePageMarkDao.update(pojo);
    }

    public int showMarkForUser(String openid) {
        int isShowMark = 0;
        OperationGuidePageMark pojo = operationGuidePageMarkDao.showMarkForUser(openid);
        if (pojo != null && pojo.getOpenid() != null) {
            isShowMark = 1;
        }
        return isShowMark;
    }

    public void saveUserMark(String openid,String pageName) {
        operationGuidePageMarkDao.insertForUser(openid,pageName);
    }
}
